﻿USE master
GO

if exists(select * from sys.databases where name = 'DBAiXiu')
	drop database DBAiXiu
go

-- 创建数据库
CREATE DATABASE DBAiXiu
GO

-- 切换数据库
USE DBAiXiu
GO

-- 创建登录信息表
CREATE TABLE TBLogins
(
	Id INT PRIMARY KEY IDENTITY,		        -- 用户Id
	UserName VARCHAR(32) UNIQUE  NULL,			-- 登录名
	MobileNumber VARCHAR(11) UNIQUE  NULL,		-- 手机号
	[Password] VARCHAR(50)  NULL				-- 密码
)
GO


-- 创建用户信息表
CREATE TABLE TBUsers
(
	Id INT PRIMARY key,	            -- 用户Id
	NickName VARCHAR(16) NULL,					-- 昵称
	Avatar VARCHAR(100) NULL,					-- 头像
	Sex INT NULL,
	Birthday DATETIME2 NULL,					-- 生日
	[Address] VARCHAR(100) NULL,				-- 地址
	Hobby VARCHAR(100) NULL,					-- 爱好
	CreationTime DATETIME2  NOT NULL DEFAULT(GETDATE())	-- 创建时间
)
GO

-- 创建视频信息表
CREATE TABLE TBVideos
(
	VideoId VARCHAR(200) PRIMARY KEY,	-- 视频Id
	UserId INT ,						-- 用户Id
	Headline VARCHAR(100) NULL,			-- 标题
	[Location] VARCHAR(100) NULL,		-- 发布位置
	CoverURL VARCHAR(200) NULL,			-- 封面Url地址
	[Status] INT NULL,
	UploadTime DATETIME2 NOT NULL DEFAULT(GETDATE())	-- 上传时间
)
GO

USE [DBAiXiu]
GO
SET IDENTITY_INSERT [dbo].[TBLogins] ON 

INSERT [dbo].[TBLogins] ([Id], [UserName], [MobileNumber], [Password]) VALUES (10001, N'wuji2012', N'13858399387', N'QL0AFWMIX8NRZTKeof9cXsvbvu8=')
INSERT [dbo].[TBLogins] ([Id], [UserName], [MobileNumber], [Password]) VALUES (10002, N'hellokitty', N'18169513521', N'QL0AFWMIX8NRZTKeof9cXsvbvu8=')
INSERT [dbo].[TBLogins] ([Id], [UserName], [MobileNumber], [Password]) VALUES (10003, N'zhoujin', N'15832648014', N'QL0AFWMIX8NRZTKeof9cXsvbvu8=')
INSERT [dbo].[TBLogins] ([Id], [UserName], [MobileNumber], [Password]) VALUES (10004, N'bunny', N'15608008694', N'QL0AFWMIX8NRZTKeof9cXsvbvu8=')
INSERT [dbo].[TBLogins] ([Id], [UserName], [MobileNumber], [Password]) VALUES (10005, N'yoyo', N'18058016882', N'QL0AFWMIX8NRZTKeof9cXsvbvu8=')
INSERT [dbo].[TBLogins] ([Id], [UserName], [MobileNumber], [Password]) VALUES (10006, N'april', N'15538065359', N'FBFnigueJe4vfIsveskranSz+cU=')
INSERT [dbo].[TBLogins] ([Id], [UserName], [MobileNumber], [Password]) VALUES (10007, N'111', N'15919188726', N'HGY3qPLh914G/5mEiU1r0Wo6Nqk=')
SET IDENTITY_INSERT [dbo].[TBLogins] OFF
GO
INSERT [dbo].[TBUsers] ([Id], [NickName], [Avatar], [Sex], [Birthday], [Address], [Hobby], [CreationTime]) VALUES (10001, N'梦里寻她', NULL, 1, CAST(N'1992-05-01T00:00:00.0000000' AS DateTime2), N'河南省 郑州市', N'篮球,看电影', CAST(N'2021-11-01T10:42:47.4633333' AS DateTime2))
INSERT [dbo].[TBUsers] ([Id], [NickName], [Avatar], [Sex], [Birthday], [Address], [Hobby], [CreationTime]) VALUES (10002, N'请叫我陌北北', NULL, 2, CAST(N'1992-03-12T00:00:00.0000000' AS DateTime2), N'河南省 南阳市', N'跑步', CAST(N'2021-11-01T10:42:47.4633333' AS DateTime2))
INSERT [dbo].[TBUsers] ([Id], [NickName], [Avatar], [Sex], [Birthday], [Address], [Hobby], [CreationTime]) VALUES (10003, N'从前讲的未来', N'/avatar/41aec92634d34970a32ba51fe1258d58.jpg', 1, CAST(N'1992-06-07T00:00:00.0000000' AS DateTime2), N'河南省 许昌市', N'看电影,钢琴', CAST(N'2021-11-01T10:42:47.4633333' AS DateTime2))
INSERT [dbo].[TBUsers] ([Id], [NickName], [Avatar], [Sex], [Birthday], [Address], [Hobby], [CreationTime]) VALUES (10004, N'黎哥', NULL, 1, CAST(N'1992-05-27T00:00:00.0000000' AS DateTime2), N'河南省 新乡市', N'网络游戏', CAST(N'2021-11-01T10:42:47.4633333' AS DateTime2))
INSERT [dbo].[TBUsers] ([Id], [NickName], [Avatar], [Sex], [Birthday], [Address], [Hobby], [CreationTime]) VALUES (10005, N'可爱多', N'/avatar/b9a2b20850654793bda75a3134e8be1a.jpg', 2, CAST(N'1992-04-08T00:00:00.0000000' AS DateTime2), N'河南省 许昌市', N'逛街购物', CAST(N'2021-11-01T10:42:47.4633333' AS DateTime2))
INSERT [dbo].[TBUsers] ([Id], [NickName], [Avatar], [Sex], [Birthday], [Address], [Hobby], [CreationTime]) VALUES (10006, N'四月123', N'/Avatar/avstar3.png', 2, CAST(N'2021-11-11T00:00:00.0000000' AS DateTime2), N'天津市,河东区', N'篮球,跑步', CAST(N'2021-11-01T15:43:42.0533333' AS DateTime2))
INSERT [dbo].[TBUsers] ([Id], [NickName], [Avatar], [Sex], [Birthday], [Address], [Hobby], [CreationTime]) VALUES (10007, NULL, NULL, 0, NULL, NULL, NULL, CAST(N'2021-11-04T13:54:29.0500000' AS DateTime2))
GO

select * from TBLogins
select * from TBUsers
select * from TBVideos